package entity

import (
	"time"

	"shqsoft.cn/pasnj/base"
)

//  IndiFanaFapu 对私-理财产品信息
type IndiFanaFapu struct {
	NO          int        `gorm:"AUTO_INCREMENT;primary_key;column:PUID"` //
	PUTP        string     `gorm:"column:PUTP"`
	PutpCaption string     `gorm:"-"`
	PUNO        string     `gorm:"column:PUNO"`
	PUNM        string     `gorm:"column:PUNM"`
	CUCYID      string     `gorm:"column:CUCY"`
	CBDT        *time.Time `gorm:"column:CBDT;type:date"`
	CEDT        *time.Time `gorm:"column:CEDT;type:date"`
	BGDT        *time.Time `gorm:"column:BGDT;type:date"`
	FNDT        *time.Time `gorm:"column:FNDT;type:date"`
	CUYD        *float64   `gorm:"column:CUYD"`
	ZSFL        *float64   `gorm:"column:ZSFL"`
	CUCY        CUCY       `gorm:"ForeignKey:CUCYID"`
}

//TableName User用户表名
func (IndiFanaFapu) TableName() string {
	return "T_INDI_FAPU"

}

// AfterFind 选择产品类型
func (fapu *IndiFanaFapu) AfterFind() (err error) {
	if fapu.PUTP == "1" {
		fapu.PutpCaption = "保证收益理财产品"
	} else if fapu.PUTP == "2" {
		fapu.PutpCaption = "保本浮动收益理财产品"
	} else if fapu.PUTP == "3" {
		fapu.PutpCaption = "非保本浮动收益理财产品"
	} else {
		fapu.PutpCaption = "其他"
	}
	return
}

//对私-理财产品信息
func IndiFanaFapuEF() base.EntityFunc {
	return func() interface{} {
		entity := IndiFanaFapu{}
		return &entity
	}
}

//对私-理财产品信息
func IndiFanaFapuESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []IndiFanaFapu
		return &entities
	}
}
func init() {
	base.DaoPoolObj.Put("IndiFanaFapu", base.NewDefaultDao(IndiFanaFapuEF(), IndiFanaFapuESF(), nil))
}
